package com.idbk.chargestation.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * TabLayout适配器
 * @author zhx
 *
 */
public class CommonTabAdapter extends FragmentPagerAdapter {

	private String[] titles = {};
	private List<Fragment> mFragmentList;

	public CommonTabAdapter(FragmentManager fm, String[] titles, List<Fragment> fragmentList) {
		super(fm);
		this.titles = titles;
		this.mFragmentList = fragmentList;
	}

	@Override
	public Fragment getItem(int arg0) {
		// TODO Auto-generated method stub
		return mFragmentList.get(arg0);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mFragmentList.size();
	}

	@Override
	public CharSequence getPageTitle(int position) {
		// TODO Auto-generated method stub
		return titles[position];
	}

}
